var data = [ [ "0", "item0", "$100" ], [ "1", "item1", "$200" ] ];

var data1 = [ {
	"id" : 0,
	"name" : "Item 0",
	"price" : "$0"
}, {
	"id" : 1,
	"name" : "Item 1",
	"price" : "$1"
}, {
	"id" : 2,
	"name" : "Item 2",
	"price" : "$2"
}, {
	"id" : 3,
	"name" : "Item 3",
	"price" : "$3"
}, {
	"id" : 4,
	"name" : "Item 4",
	"price" : "$4"
}, {
	"id" : 5,
	"name" : "Item 5",
	"price" : "$5"
}, {
	"id" : 6,
	"name" : "Item 6",
	"price" : "$6"
}, {
	"id" : 7,
	"name" : "Item 7",
	"price" : "$7"
}, {
	"id" : 8,
	"name" : "Item 8",
	"price" : "$8"
}, {
	"id" : 9,
	"name" : "Item 9",
	"price" : "$9"
}, {
	"id" : 10,
	"name" : "Item 10",
	"price" : "$10"
}, {
	"id" : 11,
	"name" : "Item 11",
	"price" : "$11"
}, {
	"id" : 12,
	"name" : "Item 12",
	"price" : "$12"
}, {
	"id" : 13,
	"name" : "Item 13",
	"price" : "$13"
}, {
	"id" : 14,
	"name" : "Item 14",
	"price" : "$14"
}, {
	"id" : 15,
	"name" : "Item 15",
	"price" : "$15"
}, {
	"id" : 16,
	"name" : "Item 16",
	"price" : "$16"
}, {
	"id" : 17,
	"name" : "Item 17",
	"price" : "$17"
}, {
	"id" : 18,
	"name" : "Item 18",
	"price" : "$18"
}, {
	"id" : 19,
	"name" : "Item 19",
	"price" : "$19"
}, {
	"id" : 20,
	"name" : "Item 20",
	"price" : "$20"
} ];

var data2 = [ {
	"fnCreatedCell":"",
	"id" : 0,
	"name" : "Item 0",
	"price" : "$0"
}, {
	"fnCreatedCell":"",
	"id" : 1,
	"name" : "Item 1",
	"price" : "$1"
} ];

function test() {
	$('#table-methods-table').dataTable({
		"bSort":false,
		"bAutoWidth":true,
//		"sPaginationType": "full_numbers",
		"aLengthMenu": [[5, 10, 25, -1], [5, 10, 25, "All"]],
		"aoColumnDefs": [ {
		      "aTargets": [0],
		      "fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
	                $(nTd).html("<div class='checker'><span class=''><input type='checkbox' name='testname' id='ck"+iRow+"'><label for='ck"+iRow+"' /></span></div>");}
		    } ],
		"aoColumns" : [
		{
			"mDataProp" : null
		},
		{
			"mDataProp" : "id"
		},
		{
			"mDataProp" : "name"
		},

		{
			"mDataProp" : "price"
		} ],
		"data" : data1
	});
}

jQuery("input:checkbox").live("click",function(){
	if(jQuery(this).attr("class")=='group-checkable')
	{
		var temp=jQuery(this).is(":checked");
		jQuery(this).closest("table").find('input:checkbox').each(function(){
			if(temp)
			{
				jQuery(this).parent('span').addClass("checked");
			}
			else
			{
				jQuery(this).parent('span').removeClass("checked");
			}
		});
		return;
	}
	
	var temp=jQuery(this).is(":checked");
	if(temp)
	{
		jQuery(this).parent('span').addClass("checked");
	}
	else
	{
		jQuery(this).parent('span').removeClass("checked");
	}
	});


jQuery("#table-methods-table tr").live("click",function(){
	var editable=[2,3];
	var row = jQuery(this);
	for(var i=0;i<editable.length;i++)
	{
		var td=row.find("td")[editable[i]];
		if(jQuery(row).find(".mytestinput").length>i)
			return;
		jQuery(td).html("<input class='mytestinput form-control' id='"+this.rowIndex+"' type='text' value='"+jQuery(td).html()+"'>");
	}
});

jQuery(".mytestinput").live("blur",function()
{
	jQuery(this).closest("td").html(jQuery(this).val());
});


